---
title: |
  | Messages matter: How voter education campaigns affect citizens’ willingness to vote for women
  | Codebook
author:
- George Kwaku Ofosu^[Assistant Professor. London School of Economics. g.ofosu@lse.ac.uk]
- Merete Bech Seeberg^[Assistant Professor. Aarhus University. m.bech@ps.au.dk]
- Michael Wahman^[Assistant Professor. Michigan State University. wahmanmi@msu.edu]
date: "`r format(Sys.Date(),'%B %d, %Y')`"
header-includes:
    - \usepackage{setspace}\onehalfspacing
    - \usepackage{fvextra}
    - \DefineVerbatimEnvironment{Highlighting}{Verbatim}{breaklines,commandchars=\\\{\}}
output:
  pdf_document: default
  theme: journal
---

<style type="text/css">
  h1,h2,h3,h4,h5,h6{
  font-size: 12pt;
}

code.r{
  font-size: 12px;
}
pre {
  font-size: 12px
}

</style>

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, tidy.opts=list(width.cutoff=80),tidy=TRUE)

```

 
\newpage
```{r results = 'hide', message=FALSE,echo=TRUE, eval=TRUE, warning=FALSE}
# R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
#install packages
#install.packages('pacman')

#load required libraries
pacman::p_load(memisc,tidyverse,formatR )# memisc_0.99.22, # tidyverse_1.3.0 #format R  Version: 1.14

# set working directory
#setwd("")


#load datasets

## conjoint data
master <- read_csv("mm_conjoint_data.csv")

## respondents data
psat <- read_csv('mm_respondent_data.csv')



```

# Conjoint data

```{r results = 'hide',message=FALSE, echo=TRUE, eval=TRUE, warning=FALSE}

## conjoint data

conjoint_dat <- data.set(master)
class(conjoint_dat)

names(conjoint_dat) <- names(master)



conjoint_dat <- within(conjoint_dat, {
  description(round_num) <- "Conjoint round"
description(rd_rand_a_party) <-  "Party of candidate"
description(rd_rand_a_promises) <- "Candidate policy focus"
description(rd_rand_a_education) <- "Level of education of candidate"
description(rd_rand_a_gender) <- "Gender of candidate"
description(rd_rand_a_profession) <-  "Profession/occupation of candidate"                
description(PARENT_KEY) <- "Respondent ID"
description(KEY) <-"Respondent-conjoint-profile round (pairs) ID"
description(candidate) <- "Candidate number in pair"
description(outcome_binary_resp) <- "Whether respondent will vote for candidate in profile"
description(outcome_binary_other) <- "Whether others will vote for candidate in profile"
description(resp_pref_first) <- "Whether respondent's was randomly assigned to choose their preferred candidate first"

foreach(x=c(round_num,rd_rand_a_party,
            rd_rand_a_promises,rd_rand_a_education,
            rd_rand_a_gender,rd_rand_a_profession,
            candidate,outcome_binary_resp,
            outcome_binary_other,resp_pref_first),
        {measurement(x) <- "ordinal"                                    })


labels(round_num) <- c("First"      = 1,
          "Second"     = 2,
          "Third"      = 3,
          "Fourth"     = 4,
          "Fifth" = 5,
          "Sixth" = 6)

labels(rd_rand_a_party) <-  c("Independent"= 0 , "Minor"= 1, "Major"=2)
labels(rd_rand_a_promises) <- c("Boreholes"=0, "Education"=1, "Roads"=2)
labels(rd_rand_a_education) <- c("Secondary"=0, "University"=1)
labels(rd_rand_a_gender) <- c("Male"=0, "Female"=1)
labels(rd_rand_a_profession) <-  c("Teacher"=0, "Maize farmer"=1,"Major business owner"=2)           
labels(candidate) <- c("First"= 1, "Second"= 2)
labels(outcome_binary_resp) <- c("No"= 0, "Yes"= 1)
labels(outcome_binary_other) <- c("No"= 0, "Yes"= 1)
labels(resp_pref_first) <- c("No"= 0, "Yes"= 1)

})




```

\newpage
# Descriptive statistics of variables in conjoint data
```{r message=FALSE,echo=TRUE, eval=TRUE,warning=FALSE}
memisc::codebook(conjoint_dat)
```


\newpage
# Respondents' characteristics


```{r results = 'hide',message=FALSE, echo=TRUE, eval=TRUE, warning=FALSE}
## personal data
resp_dat <- data.set(psat)
names(resp_dat) <- names(psat)

resp_dat <- within(resp_dat, {
  description(SubmissionDate) <- "Interview date"
  description(KEY) <- "Respondent ID"
  description(enumerator) <- "Enumerator name"
  description(q2) <- "Constituency name"
  description(region) <- "Region name"
  description(party_order) <- "Order of display of conjoint attribute: Party"
description(promises_order) <- "Order of display of conjoint attribute: Policy focus"
description(education_order) <- "Order of display of conjoint attribute: Education"
description(gender_order) <- "Order of display of conjoint attribute: Gender"
description(profession_order) <- "Order of display of conjoint attribute: Profession/occupation"
  
  description(q5_age) <- "Respondent age"
                   description(female) <- "Respondent gender (female=1)"
                   description(primary_or_less) <- "Education level"
                   description(employed) <- "Employment status"
                   description(correctMPname) <- "Respondent correctly named constituency's Member of Parliament"
                   description(correctMPparty) <- "Respondent correctly named party of constituency's Member of Parliament"
                   description(close_to_a_party) <- "Respondent report being close to a party"
                   description(party_dpp) <- "Party close to: DPP"
                   description(party_mcp) <- "Party close to: MCP"
                   description(party_utm) <- "Party close to: UTM"
                   description(turnout_last_elect) <- "Respondent voted in last election"
                   description(own_radio ) <- "Asset ownership: radio"                
                   description(own_tv) <- "Asset ownership: television"
                   description(own_motor) <- "Asset ownership: motorcycle"
                   description(own_mobile  ) <- "Asset ownership: mobile phone "  
                   description(total_assets) <- "Total asset ownership"
                   description(ethnic_chewa) <- "Ethnicity: Chewa"
                   description(ethnic_lomwe) <- "Ethnicity: Lomwe"
                   description(ethnic_yao) <- "Ethnicity: Yao"
                   description(conservative) <- "Hold conservative attitude towards women"
                   description(tr_video) <- "Video treatment"
                   description(q4) <- "Respondent gender (orginal)"
                   description(q23) <- "What message did you take from the video?"
                   description(q24) <- "Which of the following do you think best describe the video"
                   description(q27) <- "Do you feel close to any particular party?"
                   description(q28) <- "What party is that?"
                   description(validdata) <- "Whether data was part of pilot survey"
                   description(q19_v) <- "In parliamentary elections, it is better to vote for a man than a woman because the man is more likely to win."
description(q20_v) <- "After the 2025 elections, we will have more women MPs than we have today"
description(q21_v) <- "A woman running for parliament in my constituency is likely to be unsuccessful as she would face discriminations from parties or voters."
description(q22_v) <- "Men make better political leaders than women"
description(tr_video_lv) <- "Video treatment(change reference category)"


foreach(x=c(region,q2, q4,party_order,promises_order,
            education_order,gender_order,profession_order,q19_v, q20_v,q21_v, q22_v,q23,q24,q27,q28,tr_video,female,
            primary_or_less,employed,agric_worker,correctMPname,correctMPparty,close_to_a_party,
            party_dpp,party_mcp,party_utm,
            turnout_last_elect,own_radio,own_tv,own_motor,own_mobile,
            total_assets,ethnic_chewa,ethnic_lomwe,
            ethnic_yao ,ethnic_sena ,conservative,validdata,tr_video_lv),
        {measurement(x) <- "ordinal"                                    })




labels(region) <- c("Central" =2, "Southern"=3)
labels(q2) <-  c("Nkhotakota South East" = 47, 
"Nkhotakota North East" = 44, 
	"Ntchisi South"=49,
"Ntchisi North"=50,
"Salima Central"=60,
"Salima North"=59,
"Chiradzulu East"=143,
"Chiradzulu South"=140,
"Nsanje North"=193,
"Nsanje Central"=191,
"Phalombe  Central"=170,
"Phalombe South"=169)
labels(q4) <- c("Male" =1, "Female"=2, "Prefer not to say" =3,                                            "Missing" = NA)
labels(q19_v) <-  c("Strongly agree" = 1, 
"Agree" =2,
"Disagree" =3,
"Strongly disagree"=4,
	"Refuse to answer" = -999, 
"Do not know [do not read]" = 999,                                            "Missing" = NA)
labels(q20_v) <- c("Strongly agree" = 1, 
"Agree" =2,
"Disagree" =3,
"Strongly disagree"=4,
	"Refuse to answer" = -999, 
"Do not know [do not read]" = 999,                                            "Missing" = NA)
labels(q21_v) <-  c("Strongly agree" = 1, 
"Agree" =2,
"Disagree" =3,
"Strongly disagree"=4,
	"Refuse to answer" = -999, 
"Do not know [do not read]" = 999,                                            "Missing" = NA)
labels(q22_v) <- c("Strongly agree" = 1, 
"Agree" =2,
"Disagree" =3,
"Strongly disagree"=4,
	"Refuse to answer" = -999, 
"Do not know [do not read]" = 999,                                            "Missing" = NA)
labels(female) <-  c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(primary_or_less) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(employed) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(agric_worker) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(correctMPname) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(correctMPparty) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(close_to_a_party) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(party_dpp) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(party_mcp) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(party_utm) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(turnout_last_elect) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(own_radio) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
  labels(own_tv) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(own_motor) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(own_mobile) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(total_assets) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(ethnic_chewa) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(ethnic_lomwe) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(ethnic_yao ) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(ethnic_sena ) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(conservative) <- c("No"=0, "Yes"=1,                                            "Missing" = NA)
labels(q24) <- c("Voting for a woman running for MP is often a waste of one’s vote, as she is unlikely to win" = 1,
"Voting for a woman running for MP can help her win"= 2,
"None of the above"=3,
"Refuse to answer"=998,
"Do not know [do not read]"=999)
labels(q27) <- c("No (Does not feel close to ANY party)" =1,
"Yes (Feel close to a party)" =2,
"Refused to answer (do not read)" = -999, 
"Do not know [do not read] (do not read)" = 999)
labels(q28) <- c("Alliance for Democracy (AFORD)"=	1,
"Democratic Progressive Party (DPP)"=	2,
"Malawi Forum for Unity and Development (MAFUNDE)"=	3,
"Malawi Congress Party (MCP)"=	4,
"National Salvation Front (NSF)"=	5,
"New Rainbow Coalition Party (NARC)"=		6,
"People’s Democratic Movement (PDM)"=		7,
"People’s Party (PP)"=		8,
"People’s Progressive Movement (PPM)"	=	9,
"People’s Transformation Party (PETRA)"	=	10,
"Republican Party (RP)"	=	11,
"United Democratic Front (UDF)"	=	12,
"New Labor Party (NLP)"=		13,
"Chipani Cha Fuko (CCP)"	=	14,
"United Independent  Party (UIP)"	=	15,
"Tonse Alliance (MCP-UTM)"	=	16,
"DPP-UDF Alliance" =		17,
"United Transformation Movement (UTM)"	=	18,
"Mbakuwaku Movement for Development (MMD)"=		19,
"Other"	=	99,
"Refused to answer"	=	-999,
"Do not know [do not read]"	=	999)

})





```


\newpage
# Descriptive statistics of variables in respondents' data
```{r message=FALSE,echo=TRUE, eval=TRUE,warning=FALSE}
memisc::codebook(resp_dat )
```

